package com.pwc.ackAdvance;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author fantuancyh
 * @data 2021/8/22
 */
@RestController
@Slf4j
public class ConfirmProvider {
    private static final String EXCHANGE_NAME = "confirm.exchange";
    private static final String QUEUE_NAME = "confirm.queue";
    private static final String ROUTING_KEY = "key1";

    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("confirm")
    public void send(){
        MessagePostProcessor processor = (message) ->{
            return message;
        };
        rabbitTemplate.convertAndSend(EXCHANGE_NAME,ROUTING_KEY+"12","hello world",processor);
        log.info("{}提供方发送消息",new Date());
    }
}
